1. Field of the Invention
The present invention relates to an encoding technique.
2. Description of the Related Art
Image signal encoding techniques are used to transmit, accumulate, and play back moving images. Of these techniques, an international standardization encoding method such as ISO/IEC International Standard 14496-2 (MPEG-4 Visual) has been known as a moving image encoding technique. Another international standardization encoding method is H.264 defined by ITU-T and ISO/IEC. In this specification, ITU-T Rec. H.264 Advanced Video Coding|ISO/IEC International Standard 14496-10 (MPEG-4 AVC) will be simply referred to as H.264.
These techniques are also used in the field of video cameras, recorders, and the like, and are actively applied especially to monitoring video cameras (to be referred to as monitoring cameras) recently. In the application to monitoring cameras, a moving image is often encoded at a relatively low bit rate to suppress the size of encoded data for the necessity of long-time recording. However, low-bit-rate encoding loses a large amount of information and degrades the image quality, and the monitoring camera cannot achieve original application purposes such as specifying a human face.
To prevent this, a technique of not uniformly encoding an entire frame, but detecting an important area such as a human face as a specific area to divide a frame into specific and unspecific areas is generally employed. This technique encodes a moving image to suppress the code amount in the unspecific area and prevent degradation of the image quality in the specific area.
However, this technique has a problem in which when a plurality of specific areas exist in a frame, if large code amounts are assigned to all the specific areas, the code amount of the entire frame increases and exceeds a target value. This technique also has a problem in which if code amounts are assigned averagely to all the specific areas so that the code amount of the entire frame does not exceed the target value, the specific area cannot obtain an image quality intended to specify a person or the like.
There have been proposed techniques which solve these problems by controlling assignment of the code amount to each specific area. An example of the conventional techniques is patent literature 1 (Japanese Patent Laid-Open No. 2010-193441). In patent literature 1, when the area ratio of a specific area to an entire input image is relatively high, the degree at which the code amount to be assigned to the specific area is increased is decreased. When the area ratio of a specific area to an entire input image is relatively low, the degree at which the code amount to be assigned to the specific area is increased is increased. This technique can reliably create compressed data capable of clearly playing back a face captured small. For a face captured large, an image quality high enough to recognize the face can be maintained even if the compression ratio hardly decreases.
However, in this conventional technique, even when the area ratio of a specific area to an entire input image is low, if many specific areas exist, no intended image quality may be able to be obtained. The code amount to be assigned is controlled in accordance with the area ratio of a specific area to an entire input image. For example, when an object faces sideways, the face captured small cannot be discriminated.